<template>
  <div class="generalize.vue">
    <div v-if="!$store.state.isbusNewsDitle">
      <div class="dyn_img_box">
        <div class="dyn_img_foot_t">
          <img
            src="../../../assets/imges/ghzhichuang1.png"
            alt=""
          >
        </div>
        <div class="dyn_img_foot">
          <div class="dyn_img_foot_l">
            <img
              src="../../../assets/imges/ghzhichuang2.png"
              alt=""
            >
          </div>
          <div class="dyn_img_foot_r">
            <div
              class="img_border"
              style="margin-bottom: 20px"
            >
              <img
                src="../../../assets/imges/ghzhichuang3.png"
                alt=""
              >
            </div>
            <div class="img_border">
              <img
                src="../../../assets/imges/gongyundongtai11.png"
                alt=""
              >
            </div>

          </div>
        </div>
      </div>
      <div
        class="notice_list"
        v-for="item in sonList"
        :key="item.id"
      >
        <div class="notice_box">
          <i class="yuan"></i>
          <p
            class="notice_name pointer"
            @click="handDitle(item)"
          >{{item.title}}</p>
        </div>
        <div>
          [ {{item.createdTime}} ]
        </div>
      </div>
      <div
        class="page_box"
        style="margin-top: 70px"
      >
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :page-sizes="[5,10,15]"
          :page-size="pageBid3.limit"
          layout="total, prev, pager, next, jumper"
          :total="pageBid3.totalCount"
        >
        </el-pagination>
      </div>
    </div>
    <transition name="fade">
      <div
        v-if="$store.state.isbusNewsDitle"
        class="busDitle_dog"
      >
        <mydetails
          :sonList="sonList"
          :dateils="dateils"
        ></mydetails>
      </div>
    </transition>

  </div>
</template>

<script>
import dynamicDitle from "./dynamicDitle";
export default {
  watch: {
    count(newlIst, olist) {
      this.pageBid3.totalCount = newlIst;
    },
    sonList(newlIst, olist) {
      if (this.$route.query.detailsID) {
        var obj = newlIst.find(item => item.id == this.$route.query.detailsID);
        console.log(this.$route.query.detailsID, "ceshi");
        if (this.$route.query.avt == 0 && obj) {
          this.handDitle(obj);
          this.$route.query.avt = null;
        }
      }
      newlIst.forEach(item => {
        item.img = this.$store.state.baseUrl + item.img;
      });
      this.imgs = newlIst[0].img;
    }
  },
  props: {
    sonList: {
      type: Array
    },
    count: {
      type: Number
    }
  },
  name: "generalize.vue",
  components: {
    dynamicDitle
  },
  data() {
    return {
      imgs: "",
      isbusNewsDitle: false,
      pageBid3: {
        start: 1,
        limit: 10,
        totalCount: 0,
        tatalpage: 0
      },
      dateils: {}
    };
  },
  mounted() {
    if (this.count != 0) {
      this.pageBid3.totalCount = this.count;
      console.log("====", this.count);
    }
  },
  methods: {
    handDitle(item) {
      this.dateils = item;
      this.$store.commit("handBus", true);
    },
    handleSizeChange() {},
    handleCurrentChange(val) {
      this.$emit("handSonNav", this.$parent.activeId, val, 10);
    }
  }
};
</script>

<style lang='scss' scoped>
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.5s;
}
.fade-enter,
.fade-leave-active {
  opacity: 0;
}
.notice_list {
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  .notice_box {
    display: flex;
    align-items: center;
    color: #333;
    font-size: 16px;

    .notice_name {
      margin-left: 20px;
    }
  }
}
.dyn_img_box {
  margin-bottom: 40px;
  .dyn_img_foot {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    .dyn_img_foot_l {
      border: 1px solid rgba(204, 204, 204, 1);
      padding: 7px;
    }
  }
  .dyn_img_foot_t {
    border: 1px solid rgba(204, 204, 204, 1);
    padding: 7px;
  }
}
.img_border {
  border: 1px solid rgba(204, 204, 204, 1);
  padding: 7px;
}
</style>
